package com.by.toolkit.consts;

import lombok.*;

import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Tian Wei
 * @version 1.0
 * @date 2024/3/28 8:00 PM
 */
public class WxCpApiConst {

    @Getter
    @AllArgsConstructor
    public enum WxCpExternalUserTypeEnum {

        WX_TYPE(1, "微信用户"),
        WX_CP_TYPE(2, "企业微信用户"),
        ;
        private final Integer type;

        private final String desc;

        private static final Map<Integer, WxCpExternalUserTypeEnum> MAP;

        static {
            MAP = Stream.of(WxCpExternalUserTypeEnum.values()).collect(Collectors.toMap(WxCpExternalUserTypeEnum::getType, Function.identity()));
        }

        public static WxCpExternalUserTypeEnum resolveByType(Integer type){
            return MAP.get(type);
        }
    }


    public static class ContactChangeType {
        /**
         * 新增成员事件.
         */
        public static final String CREATE_USER = "create_user";

        /**
         * 更新成员事件.
         */
        public static final String UPDATE_USER = "update_user";

        /**
         * 删除成员事件.
         */
        public static final String DELETE_USER = "delete_user";

        /**
         * 新增部门事件.
         */
        public static final String CREATE_PARTY = "create_party";

        /**
         * 更新部门事件.
         */
        public static final String UPDATE_PARTY = "update_party";

        /**
         * 删除部门事件.
         */
        public static final String DELETE_PARTY = "delete_party";

        /**
         * 标签成员变更事件.
         */
        public static final String UPDATE_TAG = "update_tag";

    }

}
